<?php

/**
 * Radcodes - SocialEngine Module
 *
 * @category   Application_Extensions
 * @package    Cmspage
 * @copyright  Copyright (c) 2009-2010 Radcodes LLC (http://www.radcodes.com)
 * @license    http://www.radcodes.com/license/
 * @version    $Id$
 * @author     Vincent Van <vincent@radcodes.com>
 */

class Cmspage_Form_Admin_Manage_Link extends Engine_Form {
	protected $_field;
	
	public function init() {
		$this->setMethod ( 'post' )->setTitle ( 'Page Link Code' )->setDescription ( 'CMSPAGES_VIEWS_SCRIPTS_ADMINMANAGE_LINK_DESCRIPTION' );
		
		$this->addElement ( 'Text', 'page_url', array ('label' => 'Page URL', 'size' => '76', 'style' => 'width: 480px;', 'onclick' => "this.focus(); this.select();" ) );
		
		$this->addElement ( 'Textarea', 'page_link', array ('label' => 'Page Link HTML', 'rows' => '3', 'style' => 'width: 480px;', 'onclick' => "this.focus(); this.select();" ) );
	
	}
	
	public function setField($cmspage) {
		$this->page_url->setValue ( $cmspage->getHref () );
		$this->page_link->setValue ( '<a href="' . $cmspage->getHref () . '">' . $cmspage->getTitle () . '</a>' );
	}
}